local ClientOHOH = _G.ClientOHOH;
local M = ClientOHOH.class.new(script, ClientOHOH.files.Client_PlayerComponent());

function M.new(self,...)
	return M(self,...);
end;


function M.ctor(self, parent)
	M.super.ctor(self, parent);	
end;

function M.dtor(self)
	M.super.dtor(self);
end;

local Lines={}
function M.CreateLine(self,obj,id)
	if Lines[id] then
		return
	end
	
	print("创建Beam",id)
	local char=game:GetService("Players").LocalPlayer.Character
	if not char then
		return
	end
	local renwu=char
	local renwup=renwu.HumanoidRootPart.Position
	--self.mBuilding 建筑物对象
	-- 创建附件
	local att0 = Instance.new("Attachment")
	local att1 = Instance.new("Attachment")

	-- 作为地形的子项（也可是部件）
	att0.Parent =renwu.HumanoidRootPart
	att1.Parent =obj

	-- 创建光束
	local beam = Instance.new("Beam")
	beam.Attachment0 = att0
	beam.Attachment1 = att1 
	beam.FaceCamera=true
	--外观参数
	--beam.Color = ColorSequence.new({ 
	--	ColorSequenceKeypoint.new(0, Color3.fromRGB(38, 255, 0)),
	--	ColorSequenceKeypoint.new(1, Color3.fromRGB(0, 255, 149))
	--}
	--)
	beam.Texture="rbxassetid://8067798848"
	beam.TextureMode = Enum.TextureMode.Wrap -- 设为 wrap 这样长度可以由 TextureLength 设置
	beam.Segments = 20 -- 默认的光束分辨率
	beam.Width0 = 2 -- 开始时较小
	beam.Width1 = 2 -- 后面放大
	beam.TextureLength =2 -- 重复的纹理为 1 格长 
	beam.TextureSpeed = 2 -- 放慢纹理的速度
	beam.Enabled = true
	beam.Parent = renwu

	beam.Name=id
	
	local objs={}
	table.insert(objs,att0)
	table.insert(objs,att1)
	table.insert(objs,beam)

	Lines[id]=objs

	return  true
end

function M.DestoryLine(self,id)
	if Lines[id] then
		
		print("销毁Beam",id)

		for _,v in pairs(Lines[id]) do
			v:Destroy()
		end
		Lines[id]=nil
	end
end


function M.isHadLine(self,id)
	if Lines[id] then
		return true
	else
		return false
	end
end


return M

